#pragma once

#include <windows.h>
#include <string>

// Low-level screen capture using Windows internal APIs
class LowLevelCapture {
public:
    LowLevelCapture();
    ~LowLevelCapture();

    bool Initialize();
    void Cleanup();
    bool CaptureActiveDesktop(HBITMAP& hBitmap, int& width, int& height);
    std::string GetLastError() const { return m_lastError; }

private:
    bool EnableRequiredPrivileges();
    bool CaptureWithMirrorDriver(HBITMAP& hBitmap, int& width, int& height);
    bool CaptureWithDirectDrawSurface(HBITMAP& hBitmap, int& width, int& height);
    bool CaptureWithSystemSession(HBITMAP& hBitmap, int& width, int& height);
    HBITMAP CreateBitmapFromFramebuffer();

private:
    std::string m_lastError;
    bool m_initialized;
    HANDLE m_hFrameBuffer;
    void* m_pFrameBufferData;
};